package com.googlecode.kipler.satisfiability.completion.rule.formula.uniformnotation;

import com.googlecode.kipler.syntax.LTLUnaryOperator;
import com.googlecode.kipler.syntax.formula.Formula;
import com.googlecode.kipler.syntax.formula.LTLUnaryFormula;


public class SometimeBetaFormula implements BetaFormula {

	private LTLUnaryFormula unFor;

	private Formula beta1, beta2;

	private boolean valid;

	public SometimeBetaFormula() {
		super();
	}

	public SometimeBetaFormula(Formula Formula) {
		setBeta(Formula);
	}

	@Override
	public Formula getBeta() {
		return unFor;
	}

	@Override
	public void setBeta(Formula Formula) {
		valid = false;
		if (Formula instanceof LTLUnaryFormula) {
			unFor = (LTLUnaryFormula) Formula;
			if (unFor.getConstructor() == LTLUnaryOperator.SOMETIME) {
				beta1 = unFor.getOperand();
				beta2 = new LTLUnaryFormula(LTLUnaryOperator.NEXT, unFor);
				valid = true;
			}
		}
	}

	@Override
	public Formula getBeta1() {
		return beta1;
	}

	@Override
	public Formula getBeta2() {
		return beta2;
	}

	public boolean isValid() {
		return valid;
	}

}
